package com.woniuxy.searchassembly.dao;

import com.woniuxy.searchassembly.model.SubwayPoint;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-05-24
 */
@Mapper
public interface SubwayPointMapper extends BaseMapper<SubwayPoint> {
    /*根据地铁站号查询这个地铁站号所有的地铁站名称*/
    @Select("select route_name from subway_point where route_no=#{routeNo}")
    List<String> queryByRouteNo(Integer routeNo);

    @Select("select * from subway_point where route_name=#{routeName}")
    /*根据地铁站名称查询这个地铁站的所有信息*/
    List<SubwayPoint> queryAllInfo(String routeName);

    /*新增站点*/
    @Insert("insert into subway_point (route_no,route_name,longitude,latitude)values(#{routeNo},#{routeName},#{longitude},#{latitude})")
    int addNewSite(SubwayPoint subwayPoint);
}
